package com.hafu.dao;

import com.hafu.model.RuKuDetail;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class RuKuDetailDao {
    // 添加入库单明细
    public boolean addRuKuDetail(RuKuDetail ruKudetail, Connection conn) throws SQLException
    {
        String sql = "insert into ruku_detail (ruku_id,sp_name,price,num) values (?,?,?,?)";
        PreparedStatement pstmt = conn.prepareStatement(sql);
        pstmt.setInt(1, ruKudetail.getRukuId());
        pstmt.setString(2, ruKudetail.getSpName());
        pstmt.setBigDecimal(3, ruKudetail.getPrice());
        pstmt.setInt(4, ruKudetail.getNum());
        int i = pstmt.executeUpdate();
        if (i > 0) {
            return true;
        } else {
            return false;
        }
    };
}
